package com.coffee.core.enums;

public enum EnumPayMethod {
    ALIPAY_WAP("alipayWap", "支付宝", ""),
    WECHAT_H5_MP("wechatH5Mp", "微信H5", ""),
    BALANCE("balance", "余额", ""),
    FRIENDS("friends", "朋友代付", ""),
    WECHAT_APPLET_MP("wechatAppletMp", "微信小程序", "");

    private String code;
    private String name;
    private String icon;

    private EnumPayMethod(String code, String name, String icon) {
        this.code = code;
        this.name = name;
        this.icon = icon;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public static EnumPayMethod getByCode(String code) {
        for (EnumPayMethod item : values()) {
            if (item.getCode().equals(code)) {
                return item;
            }
        }
        return null;
    }

    public static EnumPayMethod getByName(String name) {
        for (EnumPayMethod item : values()) {
            if (item.getName().equals(name)) {
                return item;
            }
        }
        return null;
    }

}
